package com.example.chatgptapplication.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;



@Configuration
public class ImageUploadConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String path = System.getProperty("user.dir") + "\\src\\main\\resources\\static\\img\\";
        registry.addResourceHandler("/img/**").addResourceLocations("file:" + path);

        String userPath = System.getProperty("user.dir") + "/src/main/resources/static/user/";
        registry.addResourceHandler("/user/**").addResourceLocations("file:" + userPath);
    }
}
